package com.chy.controller;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 这个类是Spring
 * ApplicationContext工具类，用于获取接口链接
 */
public class SpringUtil {

    private  static ApplicationContext classPathXmlApplicationContext;

    public static ApplicationContext applicationContext(){
        synchronized (com.chy.controller.SpringUtil.class){
            if (classPathXmlApplicationContext==null) {
                classPathXmlApplicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
            }
            return classPathXmlApplicationContext;
        }
    }
}
